package com.example.demo.service

import com.example.demo.entity.User
import com.example.demo.repository.UserRepository
import org.springframework.stereotype.Service

@Service
class UserService(
        var userRepository: UserRepository
) {
    fun GetById(id: Int): User {
        return userRepository.findById(id).get()
    }

    fun SaveUser(user: User): User {
        return userRepository.save(user)
    }

    fun GetUsers(): List<User> {
        return userRepository.findAll()
    }
}